﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 纸片人.win2dEffectControl.DataClass
{
    internal class StraightenEffectData : EffectOneSourceData
    {


        private float angle;
        private CanvasImageInterpolation interpolationMode;
        private bool maintainSize;
        public float Angle { get => angle; set { angle = value; OnPropertyChanged(); SetIsChanges(); } }

        public bool MaintainSize { get => maintainSize; set { maintainSize = value; OnPropertyChanged(); SetIsChanges(); } }
        public CanvasImageInterpolation InterpolationMode { get => interpolationMode; set { interpolationMode = value; OnPropertyChanged(); SetIsChanges(); } }
        #region 属性

        #endregion
        public override ICanvasImage GetEffect(CanvasDevice device, bool compression)
        {
            var source = GetSourceEffect(device, compression);
            if (source == null)
                return null;
            var se = new StraightenEffect();
            var effect = new StraightenEffect()
            {
                Source = source,
                Angle = (float)(Math.PI / 180 * Angle),
                InterpolationMode = InterpolationMode,
                MaintainSize = MaintainSize

            };



            return effect;
        }


    }
}